<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * Copyright (C) 2007  Robert Moss
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

?>
<script language="javascript" type="text/javascript" src="<?=$mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>
  <script language="javascript">
  
    function searchCountry(val){
      var f = document.adminForm;
      if(f){
        f.elements['search'].value = val;
        f.submit();
      }
    }
  
  </script>

<div id="right">
	<div id="rightpad">
	
<!-- Header START -->	
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
				<div class="far-right">
							<div class="button1-left"><div class="help"><a href="http://www.joomleague.de/handbuch.html" alt="<?php echo _JL_ADMIN_MANUAL;?>" title="<?php echo _JL_ADMIN_MANUAL;?>" target="blank"><?php echo _JL_ADMIN_MANUAL;?></a></div></div>
							<div class="button1-left"><div class="forum"><a href="http://www.joomleague.de/forum/" alt="<?php echo _JL_ADMIN_FORUM;?>" title="<?php echo _JL_ADMIN_FORUM;?>" target="blank"><?php echo _JL_ADMIN_FORUM;?></a></div></div>
							<div class="button1-left"><div class="about"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_INFO;?>" title="<?php echo _JL_ADMIN_INFO;?>" target="blank"><?php echo _JL_ADMIN_INFO;?></a></div></div>
				</div>
				<div class="button1-left"><div class="blank"><a href="index2.php?option=com_joomleague"></a></div></div><span class="step"><?php echo _JL_ADMIN_EDIT_FORM_COUNTRIES_COUNTRIES;?></span>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Header END -->     

    <div id="installer">
    
<!-- Title START -->    
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
      	<h2><?php echo _JL_ADMIN_EDIT_LIST_COUNTRIES_LIST;?></h2>		
<!-- Titel END -->
<!-- Info START -->			
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
<table class="content" cellpadding="4">
 <tr>
  <td><?php echo _JL_ADMIN_EDIT_LIST_COUNTRIES_HINT1;?>
  </td>
 </tr>
</table>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Info END -->	
<form action="index2.php" method="post" name="adminForm">
<!-- Navigation, Search etc. START -->   			
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
<table class="content" cellpadding="4">
 <tr>

        <td>
        <?php echo _JL_ADMIN_EDIT_LIST_COUNTRIES_SEARCH;?><input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
            <td align="center" colspan="4">
<?php
        for($i = 65; $i < 91; $i++){
          printf("<a href=\"javascript:searchCountry('%s')\">%s</a>&nbsp;&nbsp;&nbsp;&nbsp;",chr($i),chr($i));
        }        
?>      &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:searchCountry('');"><?php echo _JL_ADMIN_EDIT_LIST_COUNTRIES_ALL;?></a>
      </td>
  <td align="right" valign="center" nowrap><?php echo _JL_ADMIN_EDIT_LIST_COUNTRIES_DISPLAY;?><?php echo $pageNav->writeLimitBox(); ?></td>
 </tr>
</table>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Navigation, Search etc. END -->     

<!-- Content START -->		
				<div class="install-text2">
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist2">
  	<thead>
  	<tr>
  		<th width="20">
  			<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
  		</th>
  		<th width="20" align="center"><?php echo _JL_ADMIN_EDIT_LIST_COUNTRIES_ID;?></th>
  		<th width="30%" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_FORM_COUNTRIES_NAME_LANG;?></th>
  		<th width="35%" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_FORM_COUNTRIES_NAME;?></th>
  		<th width="35%" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_FORM_COUNTRIES_NAME_LOCAL;?></th>
      <th width="20" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_FORM_COUNTRIES_ISO_2;?></th>
      <th width="20" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_FORM_COUNTRIES_ISO_3;?></th>
      <th width="20" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_PUBLISHED;?></th>
  	</tr>
  	</thead>
<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row = &$rows[$i]; 
			mosMakeHtmlSafe($row);
       		$link = 'index2.php?option=com_joomleague&act=countries&task=edit&cid[]='. $row->countries_id;
       		     
?>
			<tr class="<?php echo "row$k"; ?>">
				<td width="20">
				<?php 
				if ( $row->checked_out) {
				$query="SELECT name FROM #__users WHERE id=".$row->checked_out;
				$database->setQuery($query);
        		$result = $database->loadResult();
        		$row->editor=$result;
			$checked = mosCommonHTML::checkedOut( $row );
			} else {
			$checked = mosHTML::idBox( $i, $row->countries_id, ($row->checked_out && $row->checked_out != $my->id ) );
			}
			echo $checked; ?>
				</td>
				<td align="center" width="20"><?php echo $row->countries_id;?></td>
				<td align="center" width="20" nowrap="nowrap">
<?php
if (file_exists($mosConfig_absolute_path."/images/joomleague/flags/".strtolower($row->countries_iso_code_2).".png")) {
	echo "<img src=\"".$mosConfig_live_site."/images/joomleague/flags/".strtolower($row->countries_iso_code_2).".png\" align=\"left\" hspace=\"2\" />";
} echo $country[$row->countries_iso_code_3];?></td>
				<td align="center" width="30%">
				<a href="<?php echo $link; ?>">
      <?php echo $row->countries_name; ?>
      </a>
				</td>
        <td width="30%" align="center"><?php echo $row->countries_localname; ?></td>
        <td><?php echo $row->countries_iso_code_2;
        if ($row->countries_iso_official==1) echo " *"; ?></td>
        <td align="left"><?php echo $row->countries_iso_code_3;
        if ($row->countries_iso_official==1) echo " *"; ?></td>
<?php

      $task = $row->published ? 'unpublish' : 'publish';
			$img = $row->published ? 'tick.png' : 'publish_x.png';
?>
      <td align="center">
        <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
          <img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="published" />
        </a>
      </td>

<?php		
    		$k = 1 - $k; } ?>
			</tr>
			<tr>
				<th align="center" colspan="9"><?php echo $pageNav->writePagesLinks(); ?></th>
			</tr>
			<tr>
				<td align="center" colspan="9"><?php echo $pageNav->writePagesCounter(); ?></td>
			</tr>
		</table>
				</div>
<!-- Content END -->	
			
        <div class="clr"></div>
      </div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
		</div>
	</div>
</div>
<div class="clr"></div>
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="act" value="<?php echo $act;?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
